package com.mwy.springbootquartzdemo2.controller;

import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class Controller1 {
    @Autowired
    private Scheduler scheduler;

    @RequestMapping("/show1")
    @ResponseBody
    public void show1(){
        System.out.println("进入show方法");
        try {
            scheduler.shutdown();
        } catch (SchedulerException e) {
            e.printStackTrace();
        }
//        try {
//            scheduler.start();
//        } catch (SchedulerException e) {
//            e.printStackTrace();
//        }
        System.out.println(scheduler);
    }
}
